import 'package:flutter/material.dart';

///zhudaihao
///2024-1-30
///普通按钮
class PlainButton extends StatelessWidget {
  ///按钮文本
  final String? text;

  ///按钮背景颜色
  final Color? bgColor;

  ///按钮宽
  final double? width;

  ///按钮高
  final double? height;

  ///按钮圆角
  final double? radius;

  ///内间距
  final EdgeInsetsGeometry? padding;

  ///外间距
  final EdgeInsetsGeometry? margin;

  ///渐变色
  final Gradient? gradient;

  ///阴影
  final List<BoxShadow>? boxShadow;

  ///按钮点击回调
  final Function? onClick;

  const PlainButton(
      {Key? key,
      this.text,
      this.bgColor,
      this.width,
      this.height,
      this.radius,
      this.padding,
      this.margin,
      this.gradient,
      this.boxShadow,
      this.onClick})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return InkWell(
      child: Container(
        height: height ?? 44,
        width: width,
        alignment: Alignment.center,
        padding: padding ?? const EdgeInsets.only(left: 16, right: 16),
        margin: margin,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(radius ?? 10),
          color: bgColor ?? const Color(0xff1644B1),
          gradient: gradient,
          boxShadow: boxShadow,
        ),
        child: Text(
          text ?? '',
          style: const TextStyle(
              color: Color(0xffDFE0E7),
              fontSize: 14,
              fontWeight: FontWeight.bold),
        ),
      ),
      onTap: () {
        if (onClick != null) {
          onClick!();
        }
      },
    );
  }
}
